#define _CRT_SECURE_NO_WARNINGS
#include "1.3_hs.h"

struct xr* csh_struct_xr(char name[], struct xr* p)
{
	strcpy(p->name, name);
	strcpy(p->sex, "Ů");
	p->age = 18;
	p->s.chinese = 150;
	p->s.english = 150;
	p->s.math = 150;
	return p;
}

void Print_struct_xr(struct xr* p)
{
	printf("%s %s %d %d %d %d\n", p->name, p->sex, p->age, p->s.chinese, p->s.english, p->s.math);
}

void test1()
{
	const int m = 20;
	int const n = 10;
	/*n = 20;//no
	m = 10;*/
	int* pm = &m;
	int* pn = &n;
	*pm = 10;
	*pn = 20;
	printf("%d %d", *pm, *pn);
}

void test2()
{
	int n = 10;
	int m = 20;
	const int* pn = &n;
	int const * pm = &m;
	/**pn = 20;//no
	*pm = 10;*/
	pn = &m;
	pm = &n;
	printf("%d %d", *pn, *pm);
}

void test3()
{
	int n = 10;
	int m = 20;
	int* const pn = &n;
	int* const pm = &m;
	/*pn = &m;no
	pm = &n;*/
	*pn = 20;
	*pm = 10;
	printf("%d %d", *pn, *pm);
}

void test4()
{
	int n = 10;
	int m = 20;
	const int* const pn = &n;
	int const * const pm = &m;
	/*pn = &m;no
	pm = &n;
	*pn = 20;
	*pm = 10;*/
	printf("%d %d", *pn, *pm);
}

int strlenf(char* p)
{
	char* s = p;
	while (*p)
	{
		p++;
	}
	return p - s;
}

int strlens(char* p, size_t sz)
{
	char* s = p;
	while (p < s + sz)
	{
		p++;
	}
	return p - s - 1;
}